type CalcFnType = (num1: number, num2: number) => number;

function foo() {
  return "abc";
}

// MyReturnType
type MyReturnType<T extends (...args: any[]) => any> = T extends (
  ...args: any[]
) => infer R
  ? R
  : never;

type MyParamterType<T extends (...args: any[]) => any> = T extends (
  ...args: infer A
) => any
  ? A
  : never;

// 获取一个函数的返回值类型
// type CalcReturnType = ReturnType<CalcFnType>;
// type FooReturnType = ReturnType<typeof foo>;

type CalcReturnType = MyReturnType<CalcFnType>;
type FooReturnType = MyReturnType<typeof foo>;

type CalcParamterType = MyParamterType<CalcFnType>;
type FooParamterType = MyParamterType<typeof foo>;

type CalcParamterType1 = OmitThisParameter<CalcFnType>;
type FooParamterType1 = OmitThisParameter<typeof foo>;

export {};
